/**
 * Create in 2012-4-11.
 */
package kit4j.tests.design.pattern;


/**
 * 
 * @author MiniKnife
 *
 */
public class TestSingleton {
	
	private static TestSingleton is = new TestSingleton("static");
	
	private static class SingletonHolder1 {
		private static TestSingleton instance = new TestSingleton("holder 1");
	}
	
//	private static class SingletonHolder2 {
//		private static TestSingleton instance = new TestSingleton("holder 2");
//		
//		static TestSingleton getInstance() {
//			return instance;
//		}
//	}
	
	public TestSingleton(String key) {
		System.out.println("create by " + key);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("main");
		System.out.println(is);
		System.out.println(SingletonHolder1.instance);
//		System.out.println(SingletonHolder2.getInstance());
	}

}
